package com.zmn.oms.zmn.business.interfaces.work;

import com.zmn.oms.common.dto.ResultDTO;
import com.zmn.oms.common.exception.OmsBaseException;
import com.zmn.oms.model.dto.order.zmn.CheckManageCompanyDTO;
import com.zmn.oms.model.dto.work.modify.must.OrderAssignDTO;
import com.zmn.oms.model.entity.detail.OrderDetail;
import com.zmn.oms.model.entity.work.OrderWork;
import com.zmn.oms.model.vo.work.OrderAssignVO;

import java.util.List;

/**
 * 类描述：工单分单 b service
 *
 * @author liuying
 * @date 2019/05/08 18:38
 */
public interface OrderWorkAssignBService {

    /**
     * 获取分单公司or服务商
     *
     * @param orderWork
     * @param orderDetail
     * @return
     */
    List<OrderAssignVO> listAssignCompany(OrderWork orderWork, OrderDetail orderDetail, Boolean auto);

    /**
     * 获取分单公司or服务商
     *
     * @param orderId
     * @param workId
     */
    List<OrderAssignVO> listAssignCompany(Long orderId, Long workId);

    /**
     * 通过尾款限制获取客服的公司
     *
     * @param manageCompanyIds
     * @param channelId
     * @param bizType
     * @return
     */
    List<Integer> listCanServCompanyFilterPaymentLimit(List<Integer> manageCompanyIds, Integer channelId, Integer bizType);

    /**
     * 返回返修单所属的服务公司
     * @param orderWork
     * @param orderDetail
     * @return
     */
    List<OrderAssignVO> listReworkOrderAssignVO(OrderWork orderWork, OrderDetail orderDetail);

    /**
     * 返回推荐工程师所属的服务公司
     * @param orderWork
     * @param orderDetail
     * @return
     */
    List<OrderAssignVO> listMasterRecommendOrderAssignVO(OrderWork orderWork, OrderDetail orderDetail);

    /**
     * 获取啄木鸟-虚拟公司
     * @param orderWork
     * @param orderDetail
     * @return
     */
	List<OrderAssignVO> listZmnAssignVirtualCompanyVO(OrderWork orderWork, OrderDetail orderDetail);

    /**
     * 获取言而有信-虚拟公司
     * @param orderWork
     * @param orderDetail
     * @return
     */
    List<OrderAssignVO> listYeyxAssignVirtualCompanyVO(OrderWork orderWork, OrderDetail orderDetail);

	/**
     * 分单
     *
     * @param orderAssignDTO
     */
    void saveAssign(OrderAssignDTO orderAssignDTO) throws OmsBaseException;

    /**
     * 分单保存
     *
     * @param orderAssignDTO
     */
    void saveAssignEvent(OrderAssignDTO orderAssignDTO) throws OmsBaseException;

    /**
     * 分单保存（不触发日志）
     *
     * @param orderAssignDTO
     */
    void saveAssignEventNoLog(OrderAssignDTO orderAssignDTO) throws OmsBaseException;

    /**
     * 记录不满足原因
     * @param orderWork
     * @param reason
     */
    void saveDissatisfy(OrderWork orderWork, List<OrderAssignVO> assignList, String reason, Boolean auto);

    /**
     * 获取啄木鸟平台分单优先级
     * @param list
     * @return
     */
	List<OrderAssignVO> listZmnPriorityAssignList(List<OrderAssignVO> list, OrderWork orderWork, OrderDetail orderDetail);

    /**
     * 获取言而有信平台分单优先级
     * @param list
     * @return
     */
    List<OrderAssignVO> listYeyxPriorityAssignList(List<OrderAssignVO> list, OrderWork orderWork);

    /**
     * 获取川南环保平台分单优先级
     * @param list
     * @return
     */
    List<OrderAssignVO> listCnhbPriorityAssignList(List<OrderAssignVO> list, OrderWork orderWork);

    /**
     * 校验服务商
     * @param dto
     * @return
     */
    ResultDTO checkManageCompany(CheckManageCompanyDTO dto);

    /**
     * 校验服务能力
     * @param dto
     * @return
     */
    Boolean checkServiceCapacity(CheckManageCompanyDTO dto);
}
